const Demo = require("./models/Demo");

exports.getDemos = async () => {
    const res = await Demo.findAll();
    return JSON.parse(JSON.stringify(res));
}

exports.addDemo = async (info) => {
    const ins = await Demo.create(info);
    return ins.toJSON();
}

exports.updateDemo = async (id, info) => {
    const ins = await Demo.update(info, {
        where: {
            id
        }
    });
    return ins.toJSON();
}

exports.deleteDemo = async (id) => {
    return await Demo.destroy({
        where: {
            id
        }
    });
}
